﻿<div id="pagecontent">
<div id="add" style="cursor:pointer; float:right; font-weight:bold; color:#FF0066;"><span id="actionname" style="text-decoration:overline">ADD NEW</span> <img  src="<?php echo base_url(); ?>assets/img/icon-32-new.png" title="<?php echo $this->lang->line('m_addmenu'); ?>" align="absmiddle"/> </div>
<?php 
	if($this->session->flashdata('message')!='')
	{ 
		
?>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="305px" height="50px" bgcolor="#FF0000"><tr><td>
<table width="300px" height="45px" bgcolor="#FFFFCC"><tr><td align="center" valign="middle">
<?php echo $this->session->flashdata('message'); ?>
</p>
</td></tr></table></td></tr></table>
</div>
<?php
	}
?>
<div id="addbigcontent">
  <div id='addmenu'> 
  <form action="<?php echo base_url().index_page(); ?>/adminpage/cpanel/add_gallery/" method="post" name="adminForm" id="adminForm" autocomplete="off" enctype="multipart/form-data">
    <fieldset style="border:none">
    <div id="addnew">
      <div style="padding-left:150px;">
        <label for="userfile"><strong><?php echo $this->lang->line('m_image'); ?></strong></label>
        <input id="userfile" name="userfile" type="file" size="35" maxlength="100" value=""/>
      </div>
      <div style="padding-left:350px;">
		<p><strong>Filetype</strong>: gif | jpg | jpeg | png</p><p><strong>Best</strong> width: 588px :: height: 331px, max size: 500KB</p>
		<p>Auto crop/ resize image if image is in different size</p>
      </div>	  	  
    <input type="hidden" name="id" value="" />
    <input type="hidden" name="component" value="com_slideshow" />
    <input type="hidden" name="option" value="add_slideshow" />
    <input type="hidden" name="myurl" value="<?php echo base_url().index_page().$this->uri->uri_string(); ?>" />
    <input type="hidden" name="task" value="" />
    <div class="toolbar"  align="center">
      <table width="100px" border="0" align="center" cellpadding="5">
        <tr>
          <td align="center"><a onclick="javascript: submitbutton('save')" href="#"><span class="icon-32-save" title="<?php echo $this->lang->line('save'); ?>"> </span><?php echo $this->lang->line('save'); ?></a></td>
          <td align="center"><a onclick="javascript: submitbutton('cancel')" href="#"><span class="icon-32-cancel" title="<?php echo $this->lang->line('cancel'); ?>"> </span><?php echo $this->lang->line('cancel'); ?></a></td>
        </tr>
      </table>
    </div>
  </fieldset>
  </form>
  </div> 
</div>
<div id="listmenu" align="center" style="width:90%; padding-left:50px;"> 
<table width="100%" id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
  <thead>
  <tr>
    <th align="center" width="60%">Images</th>
    <th align="center" width="20%" class="{sorter: false}"><?php echo $this->lang->line('table_header_action'); ?></th>
  </tr>
  </thead>
  <tbody>
  <?php
  if (isset($gallery))
  {
  		foreach($gallery as $slide)
			  {
	
	?>
  <tr>
    <td align="center"><p><img src="<?php echo base_url(); ?>/upload/gallery/<?php echo $slide['big_img']; ?>" width="300" height="250"/></p></td>
    <td align="center"><a onclick='checkdelete("<?php echo $slide['id']; ?>")' href="#"><?php echo $this->lang->line('action_delete'); ?></a></td>
  </tr>
    <?php
			  }
	}
   ?>
  
  </tbody>
</table>
<?php
		if ($this->pagination->create_links()!='')
		{
			 echo '<p align="right"><strong>Page </strong><span style="color:#FF0000">'.$this->pagination->create_links(); 
		}
?>  
  </div> <p>&nbsp;</p>
</div>
<script>
  $(document).ready(function(){
    $("#addmenu").hide();
	//$("img#vietnam").addClass('activelanguage');
    $("#add").click(function () {
	  //$("#addmenu").show('slow');
	  $('#addmenu').toggle(400); // First click should toggle to 'show'
      return false;

    });
  });
	$(document).ready(function() { 
    $("#tablesorter-demo").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the third column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            } 
        } 
    }); 
});


function checkvalidate() 
{

	if (document.getElementById("userfile").value=='')
	{
		alert ("Please choose file to upload");
		return 0;
	}
	return 1;
}


function checkdelete(id)
{	
	var value = confirm("<?php echo $this->lang->line('meg_confirm') ?>");
	if (value==false)
	{
		return;
	}
	else
	{
		location.href='<?php echo base_url().index_page()."/adminpage/cpanel/delete_gallery/"; ?>'+id;
	}
}
	
</script>